<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Subscribe
 *
 * @property int $id
 * @property string|null $model
 * @property int|null $model_id
 * @property string|null $title
 * @property string|null $logo
 * @property string|null $type_desc
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property int|null $user_id
 * @property int|null $is_subscribe 0 未关注 1 关注
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereIsSubscribe($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereLogo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereModel($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereModelId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereTypeDesc($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereUserId($value)
 * @mixin \Eloquent
 * @property string|null $href
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Subscribe whereHref($value)
 * @property-read mixed $type
 */
class Subscribe extends Model
{
    protected $table='subscribe';
    protected  $appends=['type'];
    const  WORKSHOP_BUY='workshop_buy';
    const WORKSHOP_RENT='workshop_rent';
    const LAND_BUY='land_buy';
    const  LAND_RENT='land_rent';
    const  PARK_BUY='park_buy';
    const  PARK_RENT='park_rent';
    const  BUILD_BUY='build_buy';
    const  BUILD_RENT='build_rent';
    static $typeMap=[
        self::WORKSHOP_BUY=>'厂房出售',
        self::WORKSHOP_RENT=>'厂房出租',
        self::LAND_BUY=>'土地出售',
        self::LAND_RENT=>'土地出租',
        self::PARK_BUY=>'园区出售',
        self::PARK_RENT=>'园区出租',
        self::BUILD_BUY=>'写字楼出售',
        self::BUILD_RENT=>'写字楼出租',
    ];
    public function getTypeAttribute($value)
    {
        return self::$typeMap[$this->attributes['model']];
    }
}
